package com.example.controller.admin;

import com.example.common.Result;
import com.example.dto.newPasswordDTO;
import com.example.service.AdminService;
import com.example.vo.AdminDetailVO;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wuyunbin
 * @since 2024-10-09
 */
@Slf4j
@RestController
@RequestMapping("/admin")
public class AdminController {
    @Resource
    private AdminService adminService;

    @PostMapping("detail")
    public Result<AdminDetailVO> detail() {
        AdminDetailVO vo = adminService.detail();
        return Result.success(vo);
    }

    @PostMapping("/password/update")
    public Result<?> updatePassword(@RequestBody newPasswordDTO newPasswordDTO) {
        adminService.updatePassword(newPasswordDTO);
        return Result.success();
    }

}
